{% extends "base.html" %}

{% block title %}结果{% endblock %}

{% block content %}
<div class="row justify-content-center">
    <div class="col-md-8">
        <div class="card">
            <div class="card-body">
                <h2 class="card-title text-center mb-4">诊断结果</h2>
                
                {% if result %}
                <div class="row">
                    <div class="col-md-6">
                        <div class="card mb-4">
                            <div class="card-body">
                                <h5 class="card-title">诊断结果</h5>
                                <div class="alert alert-success">
                                    <h4 class="alert-heading">预测结果：{{ result.class_name }}</h4>
                                    <p class="mb-0">置信度：{{ "%.2f"|format(result.confidence * 100) }}%</p>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-6">
                        <div class="card mb-4">
                            <div class="card-body">
                                <h5 class="card-title">处理时间</h5>
                                <p class="mb-0">诊断用时：{{ "%.2f"|format(result.processing_time) }} 秒</p>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="card mb-4">
                    <div class="card-body">
                        <h5 class="card-title">防治建议</h5>
                        <div class="alert alert-info">
                            {{ result.suggestion }}
                        </div>
                    </div>
                </div>

                <div class="text-center">
                    <a href="/upload" class="btn btn-primary">继续诊断</a>
                </div>
                {% else %}
                <div class="alert alert-warning">
                    <h4 class="alert-heading">未找到诊断结果</h4>
                    <p>请先上传图片进行诊断。</p>
                </div>
                <div class="text-center">
                    <a href="/upload" class="btn btn-primary">开始诊断</a>
                </div>
                {% endif %}
            </div>
        </div>
    </div>
</div>
{% endblock %}
